# Maintainer: Ariadne Conill <ariadne@dereferenced.org>
pkgname=ustream-ssl
pkgver=20220116
pkgrel=1
pkgdesc="ustream SSL library"
url="https://git.openwrt.org/project/ustream-ssl.git"
arch="all"
license="ISC"
depends=""
depends_dev="libubox-dev openssl-dev"
makedepends="cmake $depends_dev"
subpackages="$pkgname-dev"
_owrtgit=868fd881
_owrtver="${pkgver:0:4}-${pkgver:4:2}-${pkgver:6:2}-${_owrtgit}"
source="https://sources.openwrt.org/ustream-ssl-${_owrtver}.tar.xz"
builddir="$srcdir/ustream-ssl-${_owrtver}"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
92d65c1163fe2d2fcd6ff28c825a54bb92c552a2b1fd698502c790bd8461bfe6e08a19df45a96c356ef63acf5c277a24c0ab438c4285649d8de60926171b9348  ustream-ssl-2022-01-16-868fd881.tar.xz
"
